package main

import "fmt"

type person2 struct {
	name string
	age int
}

func main()  {
	p1:=person2{"王二狗",30}
	fmt.Printf("%p\n",&p1) //0xc42000a060
	p2:=p1
	fmt.Printf("%p\n",&p2) //0xc42000a080
	p2.name="王三狗"
	fmt.Println(p1) //{王二狗 30}
	fmt.Println(p2) //{王三狗 30}

	p3:=&p1
	fmt.Printf("%T\n",p3) //*main.person2
	p1.name="李小花"
	fmt.Println(p1) //{李小花 30}
	fmt.Println(p3) //&{李小花 30}
	fmt.Println(*p3) //{李小花 30}

	p4:=new(person2)
	fmt.Printf("%T\n",p4) //*main.person2

	p4.name="rose"
	p4.age=30
	fmt.Println(p4) //&{rose 30}
	fmt.Println(*p4) //{rose 30}
	p5:=p4
	p5.name="jack"
	fmt.Println(p4) //&{jack 30}
	fmt.Println(p5) //&{jack 30}



}
